<?php
namespace Common\Common;
abstract class Object{
    protected $data = [];

    public function __construct(array $data){
        $this->data = $data;
    }

    public function __get($name){
        $method = '_get'.$name;
        if(method_exists($this,$method))
            return call_user_func([$this, $method]);
        $name = strtolower($name);
        if(isset($this->data))
            return $this->data[$name];
        die('属性不存在，程序错误！');
    }

    public function __set($name, $value){
        $method = '_set'.$name;
        if(method_exists($this,$method))
            return call_user_func([$this, $method], $value);
        $name = strtolower($name);
        if(isset($this->data))
            return $this->data[$name] = $value;
        die('属性不存在，程序错误！');
    }
}